package Java7_Concurrency_Cookbook.thread_synchronized_helper.count_down_latch;

/**
 * VideoConference(视频会议) 对象通过调用 CountDownLatch.await() 等待所有与会者</br>
 * Participant(与会者) 对象通过调用 CountDownLatch.countDown() 来表示已经到达</br>
 * 所有与会者到达之后, VideoConference 线程将解除阻塞继续执行
 * @author lixiangke
 */
public class Main {
    public static void main(String[] args) {
        VideoConference conference = new VideoConference(10);
        Thread threadConference = new Thread(conference);
        threadConference.start();

        for (int i = 0; i < 10; i++) {
            Participant p = new Participant(conference, "Participant" + i);
            Thread t = new Thread(p);
            t.start();
        }
    }

}
